﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net;
using System.Net.Sockets;
using Simhopp.GUI;
using Simhopp.Model;

namespace Simhopp.Presenter
{
    class PresenterJudgeScreen
    {
        public InterfaceJudgeScreenView _view { get; set; }
        public InterfaceJudgeModel _modelJudge { get; set; }
        public InterfaceListenerModel _modelListener { get; set; }

        public PresenterJudgeScreen(InterfaceJudgeScreenView view, InterfaceJudgeModel modelJudge, InterfaceListenerModel modelListener)
        {
            this._view = view;
            this._modelJudge = modelJudge;
            this._modelListener = modelListener;
            this._view.EventSubmitScore += _view_EventSubmitScore;
            this._view.EventStart += _view_EventStart;
            this._view.EventStop += _view_EventStop;
        }

        void _view_EventStop()
        {
            this._modelListener.Stop();
        }

        void _view_EventStart()
        {
            this._modelListener.Start();
        }

        int _view_EventSubmitScore(string points, Socket socket, string port )
        {
            return this._modelJudge.SendResult(points, socket, port);
        }
    }
}
